
import CryptoTool from '../utils/crypto/jscrypto.js'
import { getMeta } from '../config/config.js'

const http = uni.$u.http

/**
 * 获取城市数据
 */
export const getCitysList = (params = {}) => http.post('base/system/queryAllCity', getMeta(params))
/**
 * 获取短信验证码
 * @param {string} phoneNumber 手机号
 * @param {string} smsType 验证码：smslogin 注册：register
 */
export const sendSmsCode = (params = {}) => http.post('user/sendMsgValidator', getMeta(params),{custom:{show:true,mask:true}})

/**
 * 校验手机号是否注册，返回手机号为已注册，未返回为未注册
 * @param {string} phoneNumber 手机号
*/
export const checkPhone = (params = {}) => http.post('user/checkPhoneNo', getMeta(params),{custom:{show:true,mask:true}})
/**
 * 验证码/密码登录
 * @param {string} loginType 登录类型：2：验证码登录 6：h5密码登录
 * @param {string} phoneNumber 手机号
 * @param {string} password 密码
 * @param {string} smsCode 验证码
 */
export const userLogin = (params = {}) => http.post('user/login', getMeta(params),{custom:{show:true,mask:true}})

/**
 * 用户注册
 * @param {string} phoneNumber 手机号
 * @param {string} userPassword 密码
 * @param {string} smsCode 验证码
 * @param {string} recommendCode 推荐码
 * @param {string} loginType 6：h5注册
 */
export const userRegister = (params = {}) => http.post('user/register', getMeta(params),{custom:{show:true,mask:true,title:'正在提交'}})

/**
 * 获取用户信息
 */
export const getUserInfo = (params = {}) => http.post('user/getUserInfo', getMeta(params))
/**
 * 获取报备状态信息
 */
export const getReportInfo = (params = {}) => http.post('merchant/info/getSignFlag', getMeta(params))
/**
 * 获取商户信息
 */
export const getMerchantInfo = (params = {}) => http.post('merchant/info/getMerInfo', getMeta(params))
/**
 * 通过ocr获取图片中的文字信息
 * @param {string} fileUrl 网络图片地址
 * @param {string} frontOrBack 身份证必传 F：正面  B：反面
 * @param {string} apiType ORC类型 01：身份证 02：银行卡 03：营业执照
 */
export const getImageInfoByOcr = (params = {}) => http.post('h5/api/req', getMeta(params),{custom:{show:true,mask:false}})

/**
 * 获取上传图片阿里oss配置信息
 */
export const getOssConfig = (params = {}) => http.post('oss/ststoken', getMeta(params))

/**
 * 获取开户银行列表
 */
export const getBankList = (params = {}) => http.post('base/system/queryBankBranch', getMeta(params),{custom:{show:true,mask:false}})

/**
 * 获取开户支行列表
 * @param {string} bankName 银行名称
 * @param {string} bankBranchNo 银行机构编码
 * @param {string} cityName 城市编码
 */
export const getSubBrachList = (params = {},page = 1) => http.post('base/system/queryBankInfo', getMeta(params,page),{custom:{show:true,mask:false,title:''}})

/**
 * 获取所属行业列表
 * @param {string} mccName 行业名称
 */
export const getIndustryList = (params = {},page = 1) => http.post('merchant/info/getMccInfo', getMeta(params,page),{custom:{show:true,mask:false,title:''}})

/**
 * 校验银行卡号是否是借记卡，01：借记卡
 * @param {string} cardNo 银行卡号
 */
export const checkBankCardNo = (params = {}) => http.post('base/system/queryCardInfo', getMeta(params),{custom:{show:true,mask:false,title:''}})

/**
 * 提交商户信息
 */
export const submitMerchantInfo = (params = {}) => http.post('merchant/info/submit', getMeta(params),{custom:{show:true,mask:true,title:'正在提交'}})

/**
 * 提交商户报备
 * uptType 1：结算卡 2：费率 3：商户信息 4：以上3类 5：D0开通 8：修改法人信息
 */
export const submitMerchantReport = (params = {}) => http.post('merchant/info/reportMerCnl', getMeta(params),{custom:{show:true,mask:true,title:'正在提交'}})

/**
 * 获取版本App信息
 */
export const getAppVersionInfo = (params = {}) => http.post('user/home/updateVersion', getMeta(params))

/**
 * 提交重置登录密码
 */
export const submitResetPassword = (params = {}) => http.post('user/retrievePwd', getMeta(params),{custom:{show:true,mask:true,title:'正在提交'}})
/**
 * 获取交易费率信息
 */
export const getTradeRateInfo = (params = {}) => http.post('merchant/trans/rateInfo', getMeta(params),{custom:{show:true}})

/**
 * 身份核验
 */
export const checkMerInfoByIdCard = (params = {}) => http.post('user/checkMerInfo', getMeta(params),{custom:{show:true,mask:true}})

/**
 * 人脸认证
 */
export const checkFaceAuth = (params = {}) => http.post('faceAuth/attestationFaceAuth', getMeta(params),{custom:{show:true,mask:true}})

/**
 * 获取机绑定具列表
 */
export const getBindDeviceList = (params = {}) => http.post('device/queryDeviceList', getMeta(params),{custom:{show:true}})
/**
 * 获取结算卡列表
 */
export const getBankCardList = (params = {}) => http.post('merchant/settle/settleCardQuery', getMeta(params))

/**
 * 获取结算卡列表
 */
export const unBindBankCard = (params = {}) => http.post('merchant/settle/unbindSettleCard', getMeta(params),{custom:{show:true,mask:true}})

/**
 * 绑定结算卡
 */
export const bindBankCard = (params = {}) => http.post('merchant/settle/bindSettleCard', getMeta(params),{custom:{show:true,mask:true}})

/**
 * 获取banner广告数据
 */
export const getBannerList = (params = {}) => http.post('advert/app/query', getMeta(params))

/**
 * 获取活动广告数据
 */
export const getActivityList = (params = {}) => http.post('act/bonus/queryShareBonusList', getMeta(params))

/**
 * 获取账本信息
 */
export const getAccountBookInfo = (params = {}) => http.post('merchant/trans/txnDayCollect', getMeta(params))
/**
 * 获取账本列表
 * type：1：收入列表 2：结算列表
 */
export const getAccountBookList = (params = {},type) => http.post(type == 0 ? 'merchant/trans/txnDetail' : 'merchant/trans/settleDetail', getMeta(params),{custom:{show:true,mask:false}})
/**
 * 获取签购单签名图片
 */
export const getSignImage = (params = {}) => http.post('merchant/trans/txnSign', getMeta(params))

/**
 * 提交提额认证信息
 */
export const submitLimitAuth = (params = {}) => http.post('merchant/mercLimitAuth', getMeta(params),{custom:{show:true,mask:true,title:'正在提交'}})
/**
 * 提额认证结果查询
 */
export const searchLimitAuthResult = (params = {}) => http.post('merchant/limitAuth/query', getMeta(params),{custom:{show:true,mask:true}})

/**
 * 获取消息列表
 */
export const getMessageList = (page = 1) => http.post('user/home/message', getMeta({},page),{custom:{show:true,mask:false,title:''}})
/**
 * 修改商户信息
 */
export const editMerchantInfo = (params = {}) => http.post('merchant/info/modifyMerInfo', getMeta(params),{custom:{show:true,mask:true}})
/**
 * 变更手机号
 */
export const updatePhone = (params = {}) => http.post('user/changePhone', getMeta(params),{custom:{show:true,mask:true}})

